*front matter
clear
set more off
set matsize 800

*load data; change the working directory to wherever you saved the data
use incrementingNowhere.dta

*** FIGURE 1: Discrete number of final policy acts by year ***
label define ordinal 1 "Study" 2 "Introduction" 3 "1 House" 4 "2 Houses" 5 "Gov Signed"
label values pointcount ordinal
catplot pointcount if pointcount!=0, over(year) stack asyvars vertical yti("Frequency") b1title("Year")

*** TABLE 1: Models of weighted policy events ***
*Model 1.1 
ologit pointcount  laggedannualincreaseinhealthcost laggedpctuninsured laggedpcthmopop laggedpcdrugs ideol govparty legparty gelect lelect bigbus smallbus insurance tax health liberaloadvo totalig pcgsp pctChangeRev, vce(cluster state)

*Model 1.2 
ologit pointcount  laggedannualincreaseinhealthcost laggedpctuninsured laggedpcthmopop laggedpcdrugs ideol govparty legparty gelect lelect bigbus smallbus insurance tax health liberaloadvo totalig pcgsp pctChangeRev laggedcum5pointscale natllagggedcum5pointscale, vce(cluster state)

*Model 1.3 
ologit pointcount  laggedannualincreaseinhealthcost laggedpctuninsured laggedpcthmopop laggedpcdrugs ideol govparty legparty gelect lelect bigbus smallbus insurance tax health liberaloadvo totalig pcgsp pctChangeRev laggedcum5pointscale laggedcum5pointscalesquared natllagggedcum5pointscale natllagggedcum5pointscalesquared, vce(cluster state)

*Odds ratios for model 1.3
mat b=e(b)
mata : st_matrix("oddsRatio", exp(-st_matrix("b")))
mat list oddsRatio

*** TABLE 2: Models of weighted policy events times scope ***
*Model 2.1
ologit scopexlaw5pointcount  laggedannualincreaseinhealthcost laggedpctuninsured laggedpcthmopop laggedpcdrugs ideol govparty legparty gelect lelect bigbus smallbus insurance tax health liberaloadvo totalig pcgsp pctChangeRev, vce(cluster state)

*Model 2.2
ologit scopexlaw5pointcount  laggedannualincreaseinhealthcost laggedpctuninsured laggedpcthmopop laggedpcdrugs ideol govparty legparty gelect lelect bigbus smallbus insurance tax health liberaloadvo totalig pcgsp pctChangeRev cumscopexlaw5pointcount natlcumscopexlaw5pointcount, vce(cluster state)

*Model 2.3 
ologit scopexlaw5pointcount  laggedannualincreaseinhealthcost laggedpctuninsured laggedpcthmopop laggedpcdrugs ideol govparty legparty gelect lelect bigbus smallbus insurance tax health liberaloadvo totalig pcgsp pctChangeRev cumscopexlaw5pointcount cumscopexlaw5pointcountsquared natlcumscopexlaw5pointcount natlcumscopexlaw5pointcountquare, vce(cluster state)

*Odds ratios for model 2.3
mat b=e(b)
mata : st_matrix("oddsRatio", exp(-st_matrix("b")))
mat list oddsRatio


